package com.spring.serviceimp.news;

import java.util.List;
import java.util.Map;

import com.spring.service.news.ArticlesLeibieService;
import com.struts.form.ArticlesLeibieForm;
import com.hibernate.dao.news.ArticlesLeibieServiceDao;
import com.hibernate.pojo.ArticlesLeibie;
import org.apache.commons.beanutils.BeanUtils;

public class ArticlesLeibieServiceImp implements ArticlesLeibieService {
	private ArticlesLeibieServiceDao articlesLeibieServiceDao = null;

	/**
	 * delete article leibie
	 */
	@Override
	public boolean deleteNewsLeibie(Long id) {
		return articlesLeibieServiceDao.deleteNewsLeibie(id);
		// TODO Auto-generated method stub
	}

	/**
	 * add article leibie
	 */
	@Override
	public boolean saveNewsLeibie(ArticlesLeibieForm articlesleibieform) {
		// TODO Auto-generated method stub
		ArticlesLeibie articlesleibie=new ArticlesLeibie();
		try
		{
			//copy obj
			BeanUtils.copyProperties(articlesleibie,articlesleibieform);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		return articlesLeibieServiceDao.saveNewsLeibie(articlesleibie);
	}

	
	/**
	 * update some one article leibie
	 */	
	@Override
	public boolean updateNewsLeibie(ArticlesLeibieForm articlesleibieform) {
		// TODO Auto-generated method stub
		return articlesLeibieServiceDao.updateNewsLeibie(articlesleibieform);
	}

	@Override
	public List findNewsLeibie(String hql) {
		// TODO Auto-generated method stub
		return articlesLeibieServiceDao.findNewsLeibie(hql);
	}
	
	public List findNewsLeibieTree(String hql) {
		// TODO Auto-generated method stub
		return articlesLeibieServiceDao.findNewsLeibie(hql);
	}

	public ArticlesLeibieServiceDao getArticlesLeibieServiceDao() {
		return articlesLeibieServiceDao;
	}

	public void setArticlesLeibieServiceDao(
			ArticlesLeibieServiceDao articlesLeibieServiceDao) {
		this.articlesLeibieServiceDao = articlesLeibieServiceDao;
	}
}
